#include<iostream>
#include<vector>
#include <bits/stdc++.h>
#include<bits/stdc++.h>
#include <iostream>
#include <sys/mman.h>
#include <unistd.h>
#include <fcntl.h>
#include <stdio.h>
#include <sys/time.h>
using namespace std;
void prtime(string pos, timeval &time) {
    printf("%s=", pos.c_str());
    struct timeval now;
    gettimeofday(&now, NULL);
    printf("%dms\n", int((now.tv_sec * 1000 + now.tv_usec / 1000) - (time.tv_sec * 1000 + time.tv_usec / 1000)));
    time = now;
}


int main() {
    //建立4个vector，使用列表初始化，相当与调用拷贝构造函数
    vector<int> v1;
    int temp;
    int i;
    for (i = 0; i < 100000000; ++i) {
        v1.push_back(i);
    }
    //测试1
    timeval start;
    gettimeofday(&start, NULL);
    long long ans = 0;
    for (i = 0; i < v1.size(); ++i) {
        temp=v1[i];
        ans+=temp%3;
    }
    prtime("\nend1",start);
    for (auto k = v1.begin(); k < v1.end(); ++k)
    {
        temp = *k;
        ans+=temp%3;
    }
    prtime("\nend2",start);
    for (auto k = v1.begin(); k < v1.end(); k++)
    {
        temp = *k;
        ans+=temp%3;
    }
    prtime("\nend3",start);
    i = 0;
    for (auto k = v1.begin(); i<v1.size(); ++i,++k)
    {
        temp = *k;
        ans+=temp%3;
    }
    prtime("\nend4",start);
    printf("%lld",ans);
    return 0;
}